/*
 *      Author: Guannan Ma
 *      @mythmgn
 *      Whatever license applied
 */

/* Thread safe logging system
 * */
#include "base.h"

#ifndef BASE_LIB_LIBLOG_H
#define BASE_LIB_LIBLOG_H

#ifdef __cplusplus
extern "C" {
#endif

enum LOG_LEVELS{
LOG_ERROR = 0,
LOG_INFO,
LOG_DEBUG
};

typedef unsigned int LOG_LEVEL;

#define LOGGER_STD 0
#define LOGGER_PLUGIN 1

BOOL
initLog(const LOG_LEVEL logLevel, const char *logFilePath);

BOOL
closeLog();

char*
getSTDLogDIR();
char*
getPluginLogDIR();
BOOL
logToStd(char *strings);

BOOL
logIt(const char *fName, const int lineNo, int logLevel, char *format, ...);

#define LOG_INFO(s) logIt(GET_ONLY_FILE_NAME(__FILE__), __LINE__, LOG_INFO, s)
#define LOG_ERROR(s) logIt(GET_ONLY_FILE_NAME(__FILE__), __LINE__, LOG_ERROR, s)
#define LOG_DEBUG(s) logIt(GET_ONLY_FILE_NAME(__FILE__), __LINE__, LOG_DEBUG, s)

#ifdef __cplusplus
}
#endif

#endif // LIB_LOG_H_INCLUDED
